package com.neusoft.crm.controller;

import com.neusoft.crm.po.ClientInfo;
import com.neusoft.crm.po.ClientServer;
import com.neusoft.crm.po.DataServerType;
import com.neusoft.crm.po.SysUser;
import com.neusoft.crm.service.IClientServerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 服务请求控制类
 *
 * @author msprc
 */
@RestController
public class ClientServerController {
    @Autowired
    private IClientServerService clientServerService;

    /**
     * 查询服务请求列表
     *
     * @param clientServer 信息载体
     * @return 服务请求列表
     */
    @RequestMapping("/selectClientServerListByState")
    public List<ClientServer> selectClientServerListByState(@RequestBody ClientServer clientServer) {
        return clientServerService.selectClientServerListByState(clientServer);
    }

    /**
     * 新建服务请求
     *
     * @param clientServer 服务请求信息
     * @return 受影响的行数
     */
    @RequestMapping("/createClientServer")
    public int createClientServer(@RequestBody ClientServer clientServer) {
        return clientServerService.createClientServer(clientServer);
    }

    /**
     * 指派服务请求
     *
     * @param clientServer 服务请求信息
     * @return 受影响的行数
     */
    @RequestMapping("/assignClientServer")
    public int assignClientServer(@RequestBody ClientServer clientServer) {
        return clientServerService.assignClientServer(clientServer);
    }

    /**
     * 删除服务请求
     *
     * @param clientServer 服务请求信息
     * @return 受影响的行数
     */
    @RequestMapping("/deleteClientServer")
    int deleteClientServer(@RequestBody ClientServer clientServer) {
        return clientServerService.deleteClientServer(clientServer);
    }

    /**
     * 查询所有服务类型，填充下拉框
     *
     * @return 受影响的行数
     */
    @RequestMapping("/getAllClientServerTypeName")
    List<DataServerType> getAllClientServerTypeName() {
        return clientServerService.getAllClientServerTypeName();
    }

    /**
     * 查询所有正常客户姓名，填充下拉框
     *
     * @return 受影响的行数
     */
    @RequestMapping("/getAllClientName")
    List<ClientInfo> getAllClientName() {
        return clientServerService.getAllClientName();
    }

    /**
     * 查询所有经理，填充下拉框
     *
     * @return 受影响的行数
     */
    @RequestMapping("/getAllSysName")
    List<SysUser> getAllSysName() {
        return clientServerService.getAllSysName();
    }

    /**
     * 模糊查询，根据客户名称，服务类型，创建人
     *
     * @param clientServer 服务请求信息
     * @return 符合要求的服务请求列表
     */
    @RequestMapping("/selectClientServerByTag")
    List<ClientServer> selectClientServerByTag(@RequestBody ClientServer clientServer) {
        return clientServerService.selectClientServerByTag(clientServer);
    }

    /**
     * 处理服务请求
     *
     * @param clientServer 服务请求信息
     * @return 受影响的行数
     */
    @RequestMapping("/dealClientServer")
    int dealClientServer(@RequestBody ClientServer clientServer) {
        return clientServerService.dealClientServer(clientServer);
    }

    /**
     * 反馈服务请求
     *
     * @param clientServer 服务请求信息
     * @return 受影响的行数
     */
    @RequestMapping("/feedbackClientServer")
    int feedbackClientServer(@RequestBody ClientServer clientServer) {
        return clientServerService.feedbackClientServer(clientServer);
    }
}
